(0) Obligation:
The Runtime Complexity (innermost) of the given
CpxTRS could be proven to be
BOUNDS(1, n^2).
The TRS R consists of the following rules:
leq(0, y) → true
leq(s(x), 0) → false
leq(s(x), s(y)) → leq(x, y)
if(true, x, y) → x
if(false, x, y) → y
-(x, 0) → x
-(s(x), s(y)) → -(x, y)
mod(0, y) → 0
mod(s(x), 0) → 0
mod(s(x), s(y)) → if(leq(y, x), mod(-(s(x), s(y)), s(y)), s(x))
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted Cpx (relative) TRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → z0
if(false, z0, z1) → z1
-(z0, 0) → z0
-(s(z0), s(z1)) → -(z0, z1)
mod(0, z0) → 0
mod(s(z0), 0) → 0
mod(s(z0), s(z1)) → if(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0))
Tuples:
LEQ(0, z0) → c
LEQ(s(z0), 0) → c1
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
IF(true, z0, z1) → c3
IF(false, z0, z1) → c4
-'(z0, 0) → c5
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(0, z0) → c7
MOD(s(z0), 0) → c8
MOD(s(z0), s(z1)) → c9(IF(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0)), LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(0, z0) → c
LEQ(s(z0), 0) → c1
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
IF(true, z0, z1) → c3
IF(false, z0, z1) → c4
-'(z0, 0) → c5
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(0, z0) → c7
MOD(s(z0), 0) → c8
MOD(s(z0), s(z1)) → c9(IF(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0)), LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
K tuples:none
Defined Rule Symbols:
leq, if, -, mod
Defined Pair Symbols:
LEQ, IF, -', MOD
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7, c8, c9
(3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 7 trailing nodes:
MOD(s(z0), 0) → c8
LEQ(0, z0) → c
-'(z0, 0) → c5
MOD(0, z0) → c7
IF(false, z0, z1) → c4
LEQ(s(z0), 0) → c1
IF(true, z0, z1) → c3
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → z0
if(false, z0, z1) → z1
-(z0, 0) → z0
-(s(z0), s(z1)) → -(z0, z1)
mod(0, z0) → 0
mod(s(z0), 0) → 0
mod(s(z0), s(z1)) → if(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0))
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(IF(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0)), LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(IF(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0)), LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
K tuples:none
Defined Rule Symbols:
leq, if, -, mod
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 1 trailing tuple parts
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → z0
if(false, z0, z1) → z1
-(z0, 0) → z0
-(s(z0), s(z1)) → -(z0, z1)
mod(0, z0) → 0
mod(s(z0), 0) → 0
mod(s(z0), s(z1)) → if(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0))
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
K tuples:none
Defined Rule Symbols:
leq, if, -, mod
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(7) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → z0
if(false, z0, z1) → z1
mod(0, z0) → 0
mod(s(z0), 0) → 0
mod(s(z0), s(z1)) → if(leq(z1, z0), mod(-(s(z0), s(z1)), s(z1)), s(z0))
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(s(z0), s(z1)), s(z1)), -'(s(z0), s(z1)))
K tuples:none
Defined Rule Symbols:
-
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(9) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)
Use narrowing to replace
MOD(
s(
z0),
s(
z1)) →
c9(
LEQ(
z1,
z0),
MOD(
-(
s(
z0),
s(
z1)),
s(
z1)),
-'(
s(
z0),
s(
z1))) by
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
K tuples:none
Defined Rule Symbols:
-
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(11) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
We considered the (Usable) Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
And the Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(-(x1, x2)) = x1
POL(-'(x1, x2)) = [1]
POL(0) = 0
POL(LEQ(x1, x2)) = 0
POL(MOD(x1, x2)) = x1
POL(c2(x1)) = x1
POL(c6(x1)) = x1
POL(c9(x1, x2, x3)) = x1 + x2 + x3
POL(s(x1)) = [2] + x1
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
S tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
K tuples:
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
Defined Rule Symbols:
-
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(13) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
We considered the (Usable) Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
And the Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(-(x1, x2)) = x1
POL(-'(x1, x2)) = [2]x1
POL(0) = 0
POL(LEQ(x1, x2)) = [1] + [2]x2
POL(MOD(x1, x2)) = [2]x1·x2 + x12
POL(c2(x1)) = x1
POL(c6(x1)) = x1
POL(c9(x1, x2, x3)) = x1 + x2 + x3
POL(s(x1)) = [2] + x1
(14) Obligation:
Complexity Dependency Tuples Problem
Rules:
-(s(z0), s(z1)) → -(z0, z1)
-(z0, 0) → z0
Tuples:
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
S tuples:none
K tuples:
MOD(s(z0), s(z1)) → c9(LEQ(z1, z0), MOD(-(z0, z1), s(z1)), -'(s(z0), s(z1)))
LEQ(s(z0), s(z1)) → c2(LEQ(z0, z1))
-'(s(z0), s(z1)) → c6(-'(z0, z1))
Defined Rule Symbols:
-
Defined Pair Symbols:
LEQ, -', MOD
Compound Symbols:
c2, c6, c9
(15) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(16) BOUNDS(1, 1)